package demo.test.controller;


import com.entites.DeviceSet;
import com.entites.PlamSet;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@RestController
@Slf4j
public class CollectionController {
    @Value("${server.port}")
    private String port;


    @Resource
    private RestTemplate restTemplate;



    @Value("${service-url.nacos-user-service}")
    private  String CollectionURL;
    @Value("${service-url.test-url}")
    private String PlamURL;

    /**
     * 做一个简单的查询
     * */

//    @GetMapping("/Plam/getA")
//    public List<PlamSet> getDeviceSets(){
//
//        List<PlamSet> result = dataService.getDeviceSets();
//        log.info(String.valueOf(result));
//return result;
//    }

    @GetMapping("/PLAML")
    public List<DeviceSet> getTransFormers(){

        List<DeviceSet>devices =restTemplate.getForObject(PlamURL+"/getA", ArrayList.class);
        return devices;

    }







}
